package com.xunyin.modules.mtgoodsspec.service.mapper;


import com.xunyin.common.mapper.CoreMapper;
import com.xunyin.modules.mtgoodsspec.domain.MtGoodsSpec;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;


/**
 * 规格表 Mapper 接口
 * Copyright (C) 2022-2023
 * All rights reserved, Designed By www.tonetn.com
 * 注意：
 * 本软件为讯音云商开发研制，未经购买不得使用
 * 购买后可获得全部源代码（禁止转卖、分享、上传到码云、github等开源平台）
 * 一经发现盗用、分享等行为，将追究法律责任，后果自负
 */
public interface MtGoodsSpecMapper extends CoreMapper<MtGoodsSpec> {


/*        <select id="getGoodsSpecCountList" resultType="com.member.repository.model.MtGoodsSpec">
    SELECT ANY_VALUE(`ID`) AS ID,ANY_VALUE(`GOODS_ID`) AS GOODS_ID,ANY_VALUE(`NAME`) AS NAME,ANY_VALUE(`VALUE`) AS VALUE
            </select>*/
    @Select("<script> SELECT ANY_VALUE(`ID`) AS ID,ANY_VALUE(`GOODS_ID`) AS GOODS_ID,ANY_VALUE(`NAME`) AS NAME,ANY_VALUE(`VALUE`) AS VALUE, " +
            " ANY_VALUE(`STATUS`) AS STATUS FROM mt_goods_spec t WHERE t.GOODS_ID = #{goodsId} AND t.STATUS = 'A' GROUP BY t.name " +
            " </script>")
    List<MtGoodsSpec> getGoodsSpecCountList(@Param("goodsId") Integer goodsId);

}
